package com.yopai.controller;

import com.yopai.request.GptInfoRequest;
import com.yopai.service.HttpGptService;
import com.yopai.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * @Description
 * @Author 湧哥
 * @Version 1.0
 */
@RestController
@RequestMapping("/api")
public class ChatController {

    @Autowired
    private HttpGptService httpGpt;
    @PostMapping("robot")
    public JsonData getMessage(@RequestBody GptInfoRequest gptInfo) throws IOException {
        String msg = httpGpt.getMsg(gptInfo.getInfo());
        System.out.println(msg);
        System.out.println(gptInfo.getInfo());
        return JsonData.buildSuccess(msg);
    }


}
